from pydantic import BaseModel, Field
from typing import List, Optional

class BaseJobsRule(BaseModel):
    type: Optional[int] = Field(1)
    name: Optional[str] = Field("")
    func_name: Optional[str] = Field("")
    times: Optional[int] = Field(1)
    day: Optional[int] = Field(0)
    hour: Optional[int] = Field(0)
    minute: Optional[int] = Field(0)
    second: Optional[int] = Field(0)
    state: Optional[bool] = False
    up_type: Optional[int] = Field(1)

class JobsRuleCreate(BaseJobsRule):
    ...

class JobsRuleUpdate(BaseJobsRule):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})

class BaseJobsLog(BaseModel):
    user_id: Optional[int] = Field(1)
    job_id: Optional[int] = Field(1)
    result_status: Optional[int] = Field(1)
    result_data: Optional[str] = Field("")

class JobsLogCreate(BaseJobsLog):
    ...

class JobsLogUpdate(BaseJobsLog):
    id: int
    def update_dict(self):
        return self.model_dump(exclude_unset=True, exclude={"id"})


